package com.hxzy.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public final class TimeFormater {
	public static String convert(final long timestamp) {
		Calendar calendar = Calendar.getInstance();
		calendar.setTimeInMillis(timestamp * 1000);
		long now = System.currentTimeMillis() / 1000;
		
		String formater = "yyyy-MM-dd HH:mm:ss";
		if ((now - timestamp) <= (24*60*60)) {
			formater = "HH:mm:ss";
		}
		return new SimpleDateFormat(formater).format(calendar.getTime());
	}
}
